import Cookies from 'js-cookie'

const TokenKey = 'vue_admin_template_token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

/*
* 设置setSessionStorage
* */
export function setSessionStorage(key, value) {
  window.sessionStorage.setItem(key, window.JSON.stringify(value))
}
/*
* 获取getSessionStorage
* */
export function getSessionStorage(key) {
  return JSON.parse(window.sessionStorage.getItem(key))
}
/*
* 移除removeSessionStorage
* */
export function removeSessionStorage(key) {
  window.sessionStorage.removeItem(key)
}
/*
* 全部移除clearSessionStorage
* */
export function clearSessionStorage() {
  window.sessionStorage.clear()
}
